import { baseUrl } from './config.js'

export function topList() {
	
	return new Promise((resolve, reject) => {
		uni.request({
			url: `${baseUrl}/toplist/detail`,
			methods: "GET",
			success: res => {
				let result = res.data.list;
				result.length = 4;
				resolve(result);
			}
		})
	})	
}

export function list(listId) {
	return uni.request({
		url: `${baseUrl}/playlist/detail?id=${listId}&realIP=116.25.146.177`,
		method:"GET"
	})
}

export function songDetail(songId) {
	return uni.request({
		url: `${baseUrl}/song/detail?ids=${songId}&realIP=116.25.146.177`,
		method:"GET"
	})
}


export function songSimi(songId) {
	return uni.request({
		url: `${baseUrl}/simi/song?id=${songId}&realIP=116.25.146.177`,
		method:"GET"
	})
}

export function songComment(songId) {
	return uni.request({
		url: `${baseUrl}/comment/music?id=${songId}&realIP=116.25.146.177`,
		method:"GET"
	})
}

export function songLyric(songId) {
	return uni.request({
		url: `${baseUrl}/lyric?id=${songId}&realIP=116.25.146.177`,
		method:"GET"
	})
}

export function songUrl(songId) {
	return uni.request({
		url: `${baseUrl}/song/url?id=${songId}&realIP=116.25.146.177`,
		method:"GET"
	})
}

export function searchHot() {
	return uni.request({
		url: `${baseUrl}/search/hot/detail`,
		method:"GET"
	})
}

export function searchWord(word) {
	return uni.request({
		url: `${baseUrl}/search?keywords=${word}`,
		method:"GET"
	})
}

export function searchSuggest(word) {
	return uni.request({
		url: `${baseUrl}/search/suggest?keywords=${word}&type=mobile`,
		method:"GET"
	})
}



